// 引入axios
import axios from 'axios'

//export default function httpRequest(){

//}
//函数表达式

let httpRequest = function (method, url, params, data) {
    return axios({
        url,
        method,
        baseURL: "/api",
        params,
        data,
        timeout: 10000,
        headers: {
            "content-type": "application/json;charset=utf-8",
        },
    }).then((response) => {
        return response.data;//获取到响应结果的数据
    })
}
//默认导出
export default httpRequest;